home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
UUPC3
/
MAC_SPEC
/
HOSTPATH.C
< prev
next >
Wrap
Text File
|
1991-12-02
|
1KB
|
70 lines
#ifdef THINK_C
# include "unixlibproto.h"
#endif THINK_C
#include "host.h"
#ifndef NULL
#define NULL 0L
#endif
/* canonical name conversion routines
importpath canonical -> host
exportpath host -> canonical
host your local pathname format
canonical unix style
*/
importpath( host, canon )
char * host;
char * canon;
{
int i;
strcpy(host, canon);
}
exportpath( canon, host )
char * host;
char * canon;
{
/* copy the string replacing ":" by "/" */
register char *h = host,
*c = canon;
while (*c = *h++) {
if (*c == ':') *c = '/';
c++;
}
}
/* converts Unix path to Mac path syntax */
/* Permit full Mac-style "diskname:dir:dir:...:file" specifications... dplatt */
cnvMac (upath, mpath)
char * upath,
* mpath;
{
register char *u = upath,
*m = mpath;
int vRef, len;
if (*u == SEPCHAR) {
/* put volume name on the front */
(void)GetVol((StringPtr)m, &vRef);
len = (int)(m[0]);
PtoCstr(m);
m += len;
}
else if (strchr(u, DIRCHAR) == NULL) {
*m++ = ':';
}
while ( *m = *u++ ) {
if (*m == SEPCHAR) *m = ':';
m++;
}
}